<template>
  <div class="calendar-view">
		<!-- 顶部title -->
		<div class="calendar-title font40"><span>2018—2019学年</span>第二周</div>
    <van-row :gutter="36">
      <!-- <van-col :span="8" v-for="(main, mainIndex) in fullYearDate" :key="mainIndex"> -->
      <van-col :span="24" v-for="(main, mainIndex) in fullYearDate" :key="mainIndex">
				<div style="text-align: center">
					<svg-icon icon-class="arrowTop" class="arrow-svg" @click="preMonth"/>
				</div>
				<div class="calendar-view__info">
					<!-- 上一页 -->
					<!-- 年月{{tmpYear}}年 -->
					<div class="calendar-year-month font40"><span>{{main.month}}月</span></div>
					<!-- 星期 -->
					<span 
						v-for="(item, index) in weekList" 
						:key="index" class="calendar-week font32"
						v-text="item.label"
						:class="item.value == 0 || item.value == 6?'is-holiday':''" 
					/>
					<!-- 日期 -->
					<ul class="calendar-date">
						<template v-for="(item, index) in main.list">
							<li
								:class="{ 
										// 是否是今日
										'is-today-now': isToday == item.curDate,
										// 国家规定
									 'fix-holiday': isFixHoliday.indexOf(item.gregorianFestival)>0 || isFixHoliday.indexOf(item.lunarFestival)>0, 
									 // 相反
									 'not-fix-holiday': item.gregorianFestival || item.lunarFestival,
									 // 对角线
									 'is-diagonal-line': ( main.list.length >= 36 && index == 28 ) || (main.list.length == 37 && index == 29),
									 // 周日、周末
									 'week-day': item.week == 0 || item.week == 6,  
								}"
								:key="index">	
								<div v-if="index != 28 || index !=29">
									<!-- 日期 -->
									<p v-if="item.isCurMonth" class="text-date font32">{{item.value}}</p>
									<!-- 节气、节假、农历 -->
									<p v-if="item.isCurMonth" class="text-festival font24">{{ item.gregorianFestival || item.lunarFestival || item.solarTerms || item.lunarDay }}</p>
								</div>
								<div v-else>
									<!-- 日期 -->
									<p v-if="item.isCurMonth" class="text-date font32">{{item.value}}</p>
									<!-- 节气、节假、农历 -->
									<p v-if="item.isCurMonth" class="text-festival font24">{{ item.gregorianFestival || item.lunarFestival || item.solarTerms || item.lunarDay }}</p>
								</div>
							</li>
						</template>
					</ul>
				</div>
				<div style="text-align: center">
        	<svg-icon icon-class="arrowDown" class="arrow-svg" @click="nextMonth"/>
				</div>
      </van-col>
    </van-row>
  </div>
</template>
<script>
import { util } from '@config/utils'
export default {
  name: 'calendarVeiw',
  props: {
    // 年份
    propsYear: {
      type: [Number, String],
      default() {
        return new Date().getFullYear()
      }
    }
  },
	data() {
		return {
			isToday: new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()).getTime(),
			tmpYear: this.propsYear, // 临时年份，可修改
			tmpMonth: new Date().getMonth(),
			// 周
			weekList: [
				{ label: "周日", value: 0 },
				{ label: "周一", value: 1 },
				{ label: "周二", value: 2 },
				{ label: "周三", value: 3 },
				{ label: "周四", value: 4 },
				{ label: "周五", value: 5 },
				{ label: "周六", value: 6 }
			], 
			queryDate: [],
			calendar: {
				lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, //1900-1909
            0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, //1910-1919
            0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, //1920-1929
            0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, //1930-1939
            0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, //1940-1949
            0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, //1950-1959
            0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, //1960-1969
            0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, //1970-1979
            0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, //1980-1989
            0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, //1990-1999
            0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, //2000-2009
            0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, //2010-2019
            0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, //2020-2029
            0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, //2030-2039
            0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, //2040-2049
            0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, //2050-2059
            0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, //2060-2069
            0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, //2070-2079
            0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, //2080-2089
            0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, //2090-2099
            0x0d520 //2100
        ],
				// 公历每个月份的天数普通表
				solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
				// 生肖
				Animals: ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"],
				// 24节气速查表
				solarTerm: ["小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满",
						"芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪",
						"大雪", "冬至"
				],
				// 24节气速查表,每种节气的计算数据
				sTermInfo: [0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693,
						263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758
				],
				// 农历节日
				lunarFestival: {
					"1-1": "春节",
					"1-15": "元宵节",
					"2-2": "青龙节",
					"5-5": "端午节",
					"7-7": "七夕节",
					"7-15": "中元节",
					"8-15": "中秋节",
					"9-9": "重阳节",
					"12-8": "腊八节",
					//"12-24": "小年" // 有的是23小年 有的算24小年
				},
				// 公历节日
				gregorianFestival: {
					"1-1": "元旦",
					"3-8": "妇女节",
					"3-12": "植树节",
					"5-1": "劳动节",
					"5-4": "青年节",
					"6-1": "儿童节",
					"7-1": "建党节",
					"8-1": "建军节",
					"9-10": "教师节",
					"10-1": "国庆节"
				}
			},
			fullYearDate: [],
		}
	},
	watch: {
		propsYear (val) {
			this.tmpYear = val;
			this.initPageCalendar();
		}
	},
	computed: {
		isFixHoliday() {
			return ["元旦","春节","清明节","劳动节","端午节","中秋节","国庆节"]
		}
	},
	mounted() {
		this.initPageCalendar();
	},
	methods: {
		// 上一个月
		preMonth() {
			if(this.tmpMonth == 0) {
				this.tmpMonth = 11;
				this.tmpYear -= 1;
			}else {
				this.tmpMonth -= 1;
			}
			this.initPageCalendar();
		},
		// 下一个月
		nextMonth() {
			if(this.tmpMonth == 11) {
				this.tmpMonth = 0;
				this.tmpYear += 1;
			}else {
				this.tmpMonth += 1;
			}
			this.initPageCalendar();
		},
		// 初始化页面
		initPageCalendar() {
			this.fullYearDate = [];
			const initDate = (tmpMonth) => { 
				//获取当月的天数
				let currentMonthLength = new Date(this.tmpYear, tmpMonth + 1, 0).getDate();
				//先将当月的日期塞入dateList
				let dateList = Array.from(
					{ length: currentMonthLength },
					(val, index) => {
						return {
							curDate: new Date(
									this.tmpYear,	
									tmpMonth,
									index +1,
							).getTime(),        // 当月时间戳
							isCurMonth: true,  // 是否当前月份
							value: `${index + 1}`,
							remark: index == 17 || index == 10 || index == 28 ?[{id: 1, news: '今天天气炎热，大家注意防暑工作'}]: [],    // 备注
							chineseZodiac: this.getChineseZodiac(this.tmpYear, tmpMonth, index+1), // 生肖年
							lunarDay: this.getLunarDay(this.tmpYear, tmpMonth, index+1), // 农历几月几
							lunarFestival: this.getLunarFestival(this.tmpYear, tmpMonth, index+1), // 农历节日
							gregorianFestival: this.getGregorianFestival(this.tmpYear, tmpMonth, index+1), // 公历节日
							solarTerms: this.getSolarTerms(this.tmpYear, tmpMonth, index+1),  // 节气
							week: new Date(this.tmpYear, tmpMonth, index + 1).getDay(), // 计算星期几
						};
					}
				);
				// dateList = util.deepCopy(this.queryDate)
				// 获取当月1号的星期是为了确定在1号前需要插多少天
				let startDay = new Date(this.tmpYear, tmpMonth, 1).getDay();
				// 确认上个月一共多少天
				let previousMongthLength = new Date(
					this.tmpYear,	
					tmpMonth,
					0
				).getDate();
				// 在1号前插入上个月日期
				for (let i = 0, len = startDay; i < len; i++) {
					let preMonth =  tmpMonth==0?`12月${previousMongthLength - i}日`:`${tmpMonth}月${previousMongthLength - i}日`;
					dateList = [
						{ 
							curDate: new Date(
								this.tmpYear,
								tmpMonth-1,
								previousMongthLength - i,
							).getTime(),
							isCurMonth: false, 
							value: preMonth,
							remark: [],    // 备注
							chineseZodiac: '',
							lunarFestival: '',
							gregorianFestival: '',
							chineseZodiac: this.getChineseZodiac(this.tmpYear, tmpMonth-1, previousMongthLength - i), // 生肖年
							lunarDay: this.getLunarDay(this.tmpYear, tmpMonth-1, previousMongthLength - i), // 农历几月几
							// lunarFestival: this.getLunarFestival(this.tmpYear, tmpMonth-1, previousMongthLength - i), // 农历节日
							// gregorianFestival: this.getGregorianFestival(this.tmpYear, tmpMonth-1, previousMongthLength - i), // 公历节日
							solarTerms: this.getSolarTerms(this.tmpYear, tmpMonth-1, previousMongthLength - i),  // 节气
							week: new Date(this.tmpYear, tmpMonth-1, previousMongthLength - i).getDay(),
						}
					].concat(dateList);
				}
				// 插入下个月日期（UI需求35个 - 当前月份的个数）
				let completionLength = 35 - dateList.length;
				if(completionLength != 0 ) {
					for (let i = 1, item = 1; i <= completionLength; i++, item++) {
						let nextMonth = tmpMonth==11?`1月${i}日`:`${tmpMonth*1+2}月${i}日`;
						dateList[dateList.length] = { 
							curDate: new Date(
									this.tmpYear,
									tmpMonth + 1,
									i,
							).getTime(),
							isCurMonth: false, 
							value: nextMonth,
							remark: [],    // 备注
							lunarFestival: '',
							gregorianFestival: '',
							chineseZodiac: this.getChineseZodiac(this.tmpYear, tmpMonth+1, i), // 生肖年
							lunarDay: this.getLunarDay(this.tmpYear, tmpMonth+1, i), // 农历几月几
							// lunarFestival: this.getLunarFestival(this.tmpYear, tmpMonth+1, i), // 农历节日
							// gregorianFestival: this.getGregorianFestival(this.tmpYear, tmpMonth+1, i), // 公历节日
							solarTerms: this.getSolarTerms(this.tmpYear, tmpMonth+1, i),  // 节气
							week: new Date(this.tmpYear, tmpMonth+1, i).getDay(), 
						};
					}
				}
				return dateList;
			}
			// 获取当月信息
			// for(let i = 0; i < 12; i++) {
				// this.fullYearDate.push({
				// 	month: i < 9 ? `0${i+1}`: `${i+1}`,
				// 	year: this.tmpYear,
				// 	list: initDate(i),
				// })	
			// }
			this.fullYearDate.push({
				month: this.tmpMonth +1,
				year: this.tmpYear,
				list: initDate(this.tmpMonth)
			})
			console.log(this.fullYearDate)
			// console.log(JSON.stringify(this.fullYearDate,null,4))
		},
		// 返回农历Y年的天数、闰月信息和每个月的信息
		getLunarYearDays: function (Y) {
			let sum = 348;
			let lunarMonth = new Array();
			let leapMonth = [0, 0];
			let flag = 0;
			let temp = 0x8000
			for (let i = 0; i < 12; i += 1) {
				flag = (this.calendar.lunarInfo[Y - 1900] & temp) ? 1 : 0;
				lunarMonth[i] = flag;
				sum += flag;
				temp >>= 1
			}
			leapMonth = this.getLunarMonth(Y);
			sum += leapMonth[1];
			return {
					sum: sum,
					leapMonth: leapMonth,
					lunarMonth: lunarMonth
			};
		},
		// 判断今年是否有闰月  闰月是大月还是小月
		getLunarMonth: function (Y) {
			if (this.calendar.lunarInfo[Y - 1900] & 0xf) {
				return [this.calendar.lunarInfo[Y - 1900] & 0xf, (this.calendar.lunarInfo[Y - 1900] & 0x10000) ? 30 : 29];
			}
			return [0, 0];
		},
		// 获取1900(1900-01-31)年春节到的Y-M-D的阳历日期
		gregorianCalendar: function (Y, M, D) {
			let sum = 0;
			for (let i = 1900; i < Y; i += 1) {
				if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0)) sum += 366;
				else sum += 365;
			}
			for (let i = 0; i < M - 1; i += 1) sum += this.calendar.solarMonth[i];
			if ((M > 2) && (Y % 400 == 0 || (Y % 100 != 0 && Y % 4 == 0))) sum += 1;
			sum += D - 1;
			return sum - 30;
		},
		// 获取1900年春节到的Y的阴历日期
		lunarCalendar: function (Y, M, D) {
			let sum = 0;
			let temp = null;
			for (let i = 1900; i < Y; i += 1) {
					temp = this.getLunarYearDays(i);
					sum += temp.sum;
			}
			temp = this.getLunarYearDays(Y);
			for (let i = 0; i < M - 1; i++) sum += temp.lunarMonth[i] == 0 ? 29 : 30;
			if (temp.leapMonth[0] < M) sum += temp.leapMonth[1];
			sum += D - 1;
			return sum;
		},
		// 将阳历转换为阴历
		calendarConvert: function (Y, M, D) {
			M += 1;
			let num = this.lunarCalendar(Y, M, D) - this.gregorianCalendar(Y, M, D);
			let demo = this.getLunarYearDays(Y);
			let result = 0;
			if (D > num) return [0, Y, M, (D - num)];
			M -= 1;
			if (M == 0) {
				M = 12; Y -= 1;
				demo = this.getLunarYearDays(Y);
			}
			if (M == demo.leapMonth[0]) result = 1;
			if (D == num) return [result, Y, M, demo.lunarMonth[M - 1] == 0 ? 29 : 30];
			if (num > D) num -= D;
			while (true) {
				let temp = 0;
				if (demo.leapMonth[0] == M && result == 1) {
					temp = demo.leapMonth[1];
				} else {
					temp = demo.lunarMonth[M - 1] == 0 ? 29 : 30;
				}
				if (temp > num) { num = temp - num; break; }
				num -= temp;
				if (num == 0) {
					if (demo.leapMonth[0] == M && result == 1) {
						num = demo.lunarMonth[M - 1] == 0 ? 29 : 30;
						result = 0;
					} else {
						M -= 1;
						if (M == 0) {
							M = 12; Y -= 1;
							demo = this.getLunarYearDays(Y);
						}
						if (demo.leapMonth[0] == M) {
							result = 1;
							num = demo.leapMonth[1];
						}
						else {
							num = demo.lunarMonth[M - 1] == 0 ? 29 : 30;
						}
					}
					break;
				}
				if (demo.leapMonth[0] == M && result == 1) {
					result = 0;
				} else {
					M -= 1;
					if (M == 0) {
						Y -= 1;
						M = 12;
						demo = this.getLunarYearDays(Y);
					}
					if (demo.leapMonth[0] == M) result = 1;
				}
			}
			return [result, Y, M, num];
		},
		// 获取生肖年
		getChineseZodiac(Y, M, D) {
			let lunar = this.calendarConvert(Y, M, D),
				  zhiKey = (lunar[1] - 4) % 12;
			return this.calendar.Animals[zhiKey] + "年 "
		},
		// 获取农历节日
		getLunarFestival(Y, M, D) {
			let lunar = this.calendarConvert(Y, M, D);
			return this.calendar.lunarFestival[lunar[2] + "-" + lunar[3]]
		},
		// 获取公历节日
		getGregorianFestival(Y, M, D) {
			M += 1;
			return this.calendar.gregorianFestival[M + "-" + D]
		},
		// 获取节气
		getSolarTerms(Y, M, D) {
			let lunar = this.calendarConvert(Y, M, D);
			let tm = lunar[2],
					temp = "",
					solarTerms  = "",
					// 本月对应节气的日期
					tmp1 = this.sTerm(lunar[1], tm * 2),
					tmp2 = this.sTerm(lunar[1], tm * 2 + 1);
					// 判断今天时候是对应节气的日期
			if (tmp1 == lunar[3]) solarTerms = this.calendar.solarTerm[tm * 2];
			if (tmp2 == lunar[3]) solarTerms = this.calendar.solarTerm[tm * 2 + 1];
			return solarTerms || temp;
		},
		// 节气计算
		sTerm(y, n) {
			let offDate = new Date((31556925974.7 * (y - 1900) + this.calendar.sTermInfo[n] * 60000) + Date.UTC(1900, 0, 6, 2, 5));
			return (offDate.getUTCDate());
    },
		// 农历
		getLunarDay (solarYear, solarMonth, solarDay) { // 拷贝别人又自己调整过的获取农历日期的代码，想要原来的代码估计百度一下就有了
			solarMonth += 1;  // 输入的月份加1处理
			const madd = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
      // const tgString = '甲乙丙丁戊己庚辛壬癸'
      // const dzString = '子丑寅卯辰巳午未申酉戌亥'
      const numString = '一二三四五六七八九十'
      const monString = '正二三四五六七八九十冬腊'
      const CalendarData = [0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x415B5, 0x2B6, 0x957, 0x2092F, 0x497, 0x60C96, 0xD4A, 0xEA5, 0x50DA9, 0x5AD, 0x2B6, 0x3126E, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x4155B, 0x25D, 0x92D, 0x2192B, 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, 0x30A57, 0x52B, 0x8152A, 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6, 0x414AE, 0xA57, 0x526, 0x31D26, 0xD95, 0x70B55, 0x56A, 0x96D, 0x5095D, 0x4AD, 0xA4D, 0x41A4D, 0xD25, 0x81AA5, 0xB54, 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B, 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B, 0x30D4A, 0xEA5, 0x80D65, 0x5AC, 0xAB6, 0x5126D, 0x92E, 0xC96, 0x41A95, 0xD4A, 0xDA5, 0x20B55, 0x56A, 0x7155B, 0x25D, 0x92D, 0x5192B, 0xA95, 0xB4A, 0x416AA, 0xAD5, 0x90AB5, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95]
      if (!(solarYear < 1921 || solarYear > 2020)) {
        solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11
        const timeArr = [solarYear, solarMonth, solarDay]
        let TheDate = (timeArr.length !== 3) ? new Date() : new Date(timeArr[0], timeArr[1], timeArr[2])
        let total, m, n, k
        let isEnd = false
        let theDateYear = TheDate.getFullYear()
        total = (theDateYear - 1921) * 365 + Math.floor((theDateYear - 1921) / 4) + madd[TheDate.getMonth()] + TheDate.getDate() - 38
        if (theDateYear % 4 === 0 && TheDate.getMonth() > 1) {
          total++
        }
        for (m = 0; ; m++) {
          k = (CalendarData[m] < 0xfff) ? 11 : 12
          for (n = k; n >= 0; n--) {
            if (total <= this.getBit(CalendarData[m], n)) {
              isEnd = true
              break
            }
            total = total - this.getBit(CalendarData[m], n)
          }
          if (isEnd) {
            break
          }
        }
        let cMonth, cDay // cYear,
        // cYear = 1921 + m
        cMonth = k - n + 1
        cDay = total
        if (k === 12) {
          if (cMonth === Math.floor(CalendarData[m] / 0x10000) + 1) {
            cMonth = 1 - cMonth
          }
          if (cMonth > Math.floor(CalendarData[m] / 0x10000) + 1) {
            cMonth--
          }
        }
        let run = ''
				let cDayStr = numString.charAt(cDay - 1)
        if (cMonth < 1) {
          run = `(闰${monString.charAt(parseInt(cMonth * -1)-1)})`
        }
        if (cDay % 10 !== 0 || cDay === 10) {
          cDayStr = numString.charAt((cDay - 1) % 10)
        }
        return cDay === 1 ? run + monString.charAt(cMonth - 1) + '月' : (cDay < 11 ? '初' : (cDay < 20 ? '十' : (cDay == 20 ?'廿十': (cDay < 30 ? '廿' : '三十')))) + cDayStr // tgString.charAt((cYear - 4) % 10) + dzString.charAt((cYear - 4) % 12) + '年 ' + run + monString.charAt(cMonth - 1) + '月' +
      }
    },
    getBit (m, n) { // 也是拷贝的，不是很明白这段代码干嘛的，不过很明显是处理二进制数据的
      return 29 + ((m >> n) & 1)
    },
	}
}
</script>
<style lang="less" >
	/* 日期组件 */
	.calendar-view {
		text-align: left;
		height: 100%;
		padding-bottom: 10vh;
		overflow-x: hidden;
		overflow-y: auto;
		.calendar-title {
			color: #6A4781;
			text-align: center;
			padding: 13.5px 0 37px;
			background: #E1DAE6 url("../../../assets/images/xiaolibg.png") no-repeat bottom;
			background-size: contain;	
			span {
				color: inherit;
				padding-right: 30px;
			}
		}
		.van-col {
			.arrow-svg {
				width: 30px;
				height: 30px;
				// margin: 13px 0;
			}
		}
		&__info {
			/* 年 月 */
			.calendar-year-month {
				text-align: center;
				span {
					font-size: inherit;
					color: #6A4781;
				}
			}
			/* 星期 */ 
			.calendar-week {
				width: calc(100% / 7);
				display: inline-block;
				white-space: nowrap;
				color: #3B3939;
				box-sizing: border-box;
				text-align: center;
				margin-bottom: 13.5px;
			}
			/* 日期 */
			.calendar-date {
				overflow: hidden;
				li {
					position: relative;
					width: calc(100% / 7);
					// height: 50px;
					padding: 10px 0;
					text-align: center;
					display: inline-block;
					vertical-align: middle;
					box-sizing: border-box;
					/*cursor: pointer;*/
					p {
						color: #3B3939;
					}
				}
				/* 规定放假 */
				li.fix-holiday {
					position: relative;
					&::after {
						content: '休';
						position: absolute;
						left: 0;
						top: 0;
						width: 15px;
						height: 15px;
						border-radius: 50%;
						font-size: 12px;
						background-color: #6A4781;
						color: #fff;
					}
				}
				/* 不规定放假 */
				li.not-fix-holiday {
					color: #D70C19 !important;
				}
				/* 周日、周末 */
				li.week-day {
					color: #734E87;
				}
				// /* 超过35格子对角线 */
				// li.is-diagonal-line {
				// 	/* 日期 */
				// 	.text-date {
				// 		margin-left: -0.02rem;
				// 		margin-top: -0.05rem;
				// 	}
				// 	/* 节气、节日、农历 */
				// 	.text-festival {
				// 		-webkit-text-size-adjust: none;
				// 		margin-left: -0.04rem;
				// 		margin-top: -0.03rem;
				// 	}
				// 	background: linear-gradient(
				// 		to bottom right,
				// 		rgba(201,201,201,0) 0%,
				// 		rgba(201,201,201,0) calc(50% - 0.01rem),
				// 		rgba(201,201,201,1) 50%,
				// 		rgba(201,201,201,0) calc(50% + 0.01rem),
				// 		rgba(201,201,201,0) 100%
  			// 	);
				// }
				/* 最后一天 */
				// li:nth-of-type(36) {
				// 	position: relative;
				// 	bottom: 0.3rem;
				// 	left: calc(100% / 23);
				// 	width: calc(100% / 11);
				// 	padding: 0;
				// 	border: none;
				// 	height: 0.2rem;
				// 	text-align: right;
				// 	/* 日期 */
				// }
				// /* 最后一天 */
				// li:nth-of-type(37) {
				// 	position: relative;
				// 	bottom: 0.3rem;
				// 	left: calc(100% / 11);
				// 	width: calc(100% / 11);
				// 	padding: 0;
				// 	border: none;
				// 	height: 0.2rem;
				// 	text-align: right;
				// 	/* 日期 */
				// }
				/* 今日效果 */
				li.is-today-now {
					background-color: #9161AB !important;
					border-radius: 5px;
					>div p {
						color: #fff;
					}
				}
			}
		}
	}
</style>
